package com.gugee.ins.common.dal.mapper.comment;

import com.gugee.common.mapper.GugeeMapper;
import com.gugee.ins.common.model.mysql.comment.InsComment;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 评论mapper
 * @author Huangxin
 */
public interface InsCommentMapper extends GugeeMapper<InsComment> {
    /**
     * 根据 博主uid 查找未分析语言的活跃粉丝的评论
     * @param uid
     * @return
     */
    @Select("SELECT t1.c_uid, t1.text " +
            " FROM ( SELECT c_uid, text FROM ins_comment WHERE m_uid = #{uid} AND CHAR_LENGTH( text ) > 10 ) t1 " +
            " INNER JOIN ins_blogger t2 ON t1.c_uid = t2.uid " +
            " WHERE t2.`language` IS NULL or t2.`language` = '' or t2.`language` = 'un' ")
    List<InsComment> findAnalysisLanguageCommentByUid(@Param("uid")long uid);
}